package com.computer.network.config;

import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author cgs
 * @Date 2022/8/18 14:36
 */
public class ConfigCors implements WebMvcConfigurer {
    /**
     * 配置跨域请求
     *
     * @param registry
     */
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**").//允许所有的访问请求
                allowedMethods("*").
                allowedOrigins("*").
                allowedHeaders("*");
    }
}
